import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: H_tao_X
 * Date: 2022-05-20
 * Time: 20:28
 */

// 实现一个自动刷新页面的效果
    @WebServlet("/AutoRefresh")
public class AutoRefreshServlet extends HelloServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        resp.setHeader("Refresh","1");
        resp.getWriter().write("时间戳" + System.currentTimeMillis());
    }
}
